home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
pdflib
/
bind
/
python
/
hello.py
next >
Wrap
Text File
|
1999-12-06
|
740b
|
36 lines
#!/usr/bin/python
# hello.py
# Copyright (C) 1997-99 Thomas Merz. All rights reserved.
#
# PDFlib client: hello example in Python
#
from sys import *
from pdflib import *
p = PDF_new()
if PDF_open_file(p, "hello_py.pdf") == -1:
print 'Couldn\'t open PDF file!', "hello_py.pdf"
exit(2);
PDF_set_info(p, "Author", "Thomas Merz")
PDF_set_info(p, "Creator", "hello.py")
PDF_set_info(p, "Title", "Hello world (Python)")
PDF_begin_page(p, 595, 842)
font = PDF_findfont(p, "Helvetica-Bold", "default", 0)
if font == -1:
print 'Couldn\'t set font!'
exit(3);
PDF_setfont(p, font, 18.0)
PDF_set_text_pos(p, 50, 700)
PDF_show(p, "Hello world!")
PDF_continue_text(p, "(says Python)")
PDF_end_page(p)
PDF_close(p)
PDF_delete(p);